<div id="content">
    <div id="page-heading"><h1>Edit Shopper group for <?=$this->data['Customer']['username']?></h1></div>
    <table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
        <tr>
            <th rowspan="3" class="sized">
                <?php echo $this->Html->image('../images/shared/side_shadowleft.jpg', array('alt' => '', 'width' => '20', 'height' => '300')); ?>
             </th>
            <th class="topleft"></th>
            <td id="tbl-border-top">&nbsp;</td>
            <th class="topright"></th>
            <th rowspan="3" class="sized">
                <?php echo $this->Html->image('../images/shared/side_shadowright.jpg', array('alt' => '', 'width' => '20', 'height' => '300')); ?>
             </th>
        </tr>
        <tr>
            <td id="tbl-border-left"></td>
            <td>
                <div id="content-table-inner">
                    <table border="0" width="100%" cellpadding="0" cellspacing="0">
                        <tr valign="top">
                            <td>
                                <?php 
                                if(isset($invalidate_array)){
                                    $this->Form->validationErrors = array("CustomerShopperGroup"=>$invalidate_array);
                                }
                                echo $this->Form->create("$sN", array('action' => 'edit_group', 'class' => 'form', 'type' => 'file')); ?>
                                <table border="0" cellpadding="0" cellspacing="0"  id="id-form">
                                    <?php
                                        echo $this->Session->flash();
                                    ?>
                                    <tr>
                                        <th valign="top">Shopper groups:</th>
                                        <td>
                                            <script type="text/javascript">
                                                $(document).ready(function(){
                                                    var selected_group = new Array();
                                                    <?php foreach ($selected_groups as $value) { ?>
                                                        selected_group.push(parseInt("<?=$value?>"));
                                                    <?php } ?>
                                                    $('#ShopperGroup option').each(function(){
                                                        if(check_in_array($(this).val(), selected_group)==1){
                                                            $(this).attr('selected', "selected");
                                                        }
                                                    });
                                                    $('#ShopperGroup').trigger("liszt:updated");
                                                });
                                            </script>
                                            <?php
                                                echo $this->Form->input('CustomerShopperGroup.shopper_group_id', array(
                                                                'label'     => false,
                                                                'div'       => false,
                                                                'id'        =>'ShopperGroup',
                                                                'empty'     =>'',
                                                                'type'      =>'select',
                                                                'multiple'  =>true,
                                                                'data-placeholder'=>'Select a customer type',
                                                                'options'   =>$groups,
                                                                'class'     => 'chosen med')
                                                );     
                                            ?>       
                                        </td>
                                        <td></td> 
                                    </tr>
                                    <tr>
                                        <th>&nbsp;</th>
                                        <td valign="top">
                                            <?php echo $this->Form->submit('Save', array('class' => 'submit-button','div'=>false)); ?>
                                            <?php echo $this->Html->link('Cancel', array('controller' => $lN, 'action' => 'index', 'admin' => true), array('class' => 'cancel-button')); ?>
                                        </td>
                                        <td></td>
                                    </tr>
                                </table>       
                                <?php echo $this->Form->end();?>
                            </td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>
                               <?php echo $this->Html->image('../images/shared/blank.gif', array('alt' => 'blank', 'width' => '695', 'height' => '1')); ?>
                            </td>
                            <td></td>
                        </tr>
                    </table>
                    <div class="clear"></div>
                </div>
            </td>
            <td id="tbl-border-right"></td>
        </tr>
        <tr>
            <th class="sized bottomleft"></th>
            <td id="tbl-border-bottom">&nbsp;</td>
            <th class="sized bottomright"></th>
        </tr>
    </table>
    <div class="clear">&nbsp;</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
            jQuery("#customerMenu").addClass('current');
});
</script>